package com.project.wxServer.server.login.impl;


import com.project.wxServer.constant.WXConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 作者: @author Harmon <br>
 * 时间: 2017-08-11 08:58<br>
 *
 * @gitee https://gitee.com/fuyang_lipengjun/platform
 * 描述: ApiUserUtils <br>
 */
@Service
public class ApiUser {

    private static final Logger log = LoggerFactory.getLogger(ApiUser.class);

    @Resource
    private WXConfig wxConfig;

    //替换字符串
    public String getCode(String APPID, String REDIRECT_URI, String SCOPE) {
        return String.format(wxConfig.getGetCode(), APPID, REDIRECT_URI, SCOPE);
    }

    //替换字符串
    public String getWebAccess(String CODE) {
        return String.format(wxConfig.getWebAccessTokenhttps(),
                wxConfig.getAppId(),
                wxConfig.getSecret(),
                CODE);
    }

    //替换字符串
    public String getUserMessage(String access_token, String openid) {
        return String.format(wxConfig.getUserMessage(), access_token, openid);
    }
}
